#include<bits/stdc++.h>
using namespace std;
int n;
int a[100010],b[100010],c[100010];
int a1[100010],b1[100010],c1[100010];
int main()
{
	freopen("summer.in","r",stdin); 
	freopen("summer.out","w",stdout); 
	cin>>n;
	for(int i=1;i<=n;i++)scanf("%d%d%d",&a[i],&b[i],&c[i]);
	for(int i=1;i<=n;i++)
	{
		a1[i]=max(b1[i-1],c1[i-1])+a[i];
		b1[i]=max(a1[i-1],c1[i-1])+b[i];
		c1[i]=max(b1[i-1],a1[i-1])+c[i];
	}
	cout<<max(max(a1[n],b1[n]),c1[n]);
	
	return 0;
} 
